package com.shop.jpa.domain;

import com.shop.util.IdSignUtil;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Transient;
import java.io.Serializable;

public abstract class BaseDomain implements Serializable {

    public abstract Long getId();

    @Transient
    private String sign;

    public String getSign() {
        if(StringUtils.isNotBlank(this.sign)) return this.sign;
        return IdSignUtil.doSign(this.getId());
    }

    public void setSign(String sign) {
        this.sign = sign;
    }
}
